<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        *{
            box-sizing: border-box;
        }
        img{
            width: 200px;
            height: 100px;
        }
        .active{
            border: 2px solid red;
        }
    </style>
</head>
<body>
    <div id="app">
        <img v-bind:src="imgSrc" >
        <br>
        <img :src="imgSrc" :title="imgTitle+'!!!'" 
        :class="isActive?'active':''" @click="toogleActive">
        <br>
        <img :src="imgSrc" :title="imgTitle+'!!!'" 
        :class="{active:isActive}" @click="toogleActive">
    </div>
    <script>
        var app = new Vue({
            el:"#app",
            data:{
                imgSrc:"img/1.jpg",
                imgTitle:"程序猿",
                isActive:false
            },
            methods:{
                toogleActive:function(){
                    this.isActive = !this.isActive;
                }
            }
        })
    </script>
</body>
</html>